<template>
  <a-card >
    <div>
      <a-table
        ref="table"
        size="middle"
        :scroll="{x:true}"
        bordered
        rowKey="id"
        :columns="columns"
        :dataSource="dataSource"
        :pagination='false'
        :loading="loading"
        class="j-table-force-nowrap"
        @change="handleTableChange">
        <span slot="action" slot-scope="text, record">
          <a @click="handleEdit(record)">编辑</a>
          <a-divider type="vertical" />
          <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
                  <a>删除</a>
          </a-popconfirm>
        </span>
      </a-table>
    </div>
    <contacts-modal ref="modalForm" @ok="modalFormOk"></contacts-modal>
  </a-card>
</template>
<!--:rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"-->
<script>

  import '@assets/less/TableExpand.less'
  import { mixinDevice } from '@/utils/mixin'
  import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  import ContactsModal from './ContactsModal'
  import {filterMultiDictText} from '@comp/dict/JDictSelectUtil'
  import Area from '@comp/_util/Area'

  export default {
    name: 'ContactsList',
    mixins:[JeecgListMixin, mixinDevice],
    components: {
      ContactsModal
    },
    data () {
      return {
        description: '联系人表管理页面',
        // 表头
        columns: [
          {
            title: '序号',
            dataIndex: '',
            key:'rowIndex',
            width:60,
            align:"center",
            customRender:function (t,r,index) {
              return parseInt(index)+1;
            }
          },
          {
            title:'联系人姓名',
            align:"center",
            dataIndex: 'name'
          },
          // {
          //   title:'类型',
          //   align:"center",
          //   dataIndex: 'telephoneIds'
          // },
          {
            title:'联系电话',
            align:"center",
            dataIndex: 'telephoneIds_dictText'
          },
          {
            title: '操作',
            dataIndex: 'action',
            align:"center",
            fixed:"right",
            width:147,
            scopedSlots: { customRender: 'action' }
          }
        ],
        url: {
          list: "/contacts/contacts/list",
          delete: "/contacts/contacts/delete",
          deleteBatch: "/contacts/contacts/deleteBatch",
          exportXlsUrl: "/contacts/contacts/exportXls",
          importExcelUrl: "contacts/contacts/importExcel",

        },
        dictOptions:{},
        pcaData:'',
        superFieldList:[],
      }
    },
    created() {
      this.pcaData = new Area()
      this.getSuperFieldList();
    },
    computed: {
      importExcelUrl: function(){
        return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
      },
    },
    methods: {
      getPcaText(code){
        return this.pcaData.getText(code);
      },
      initDictConfig(){
      },
      getSuperFieldList(){
        let fieldList=[];
        fieldList.push({type:'string',value:'name',text:'联系人',dictCode:''})
        fieldList.push({type:'string',value:'telephoneIds',text:'电话IDS',dictCode:''})
        this.superFieldList = fieldList
      }
    }
  }
</script>
<style scoped>
  @import '~@assets/less/common.less';
</style>